<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>JSP Page</title>
      <script>
        window.onload = function () {
        var idcode=document.getElementById("randnum");
        idcode.value=rand(10);
        // 生成随机码
        function rand(number){
            //用来存储产生的随机数
            var num="";
            for(var i=0;i<number;i++){
                num+=Math.floor(Math.random()*10);
            }
            return num;
        }
    };
</script>
    </head>
    <body>
        <h1>Hello World!</h1>      
        <form name="form" action="getPost" method="POST" enctype="multipart/form-data">
          姓名：<input type="text" name="name" value="" style="width:98px;height:16px" /><p/>
          密码：<input type="password" name="password" value="" style="width:98px;height:16px" /><p/>
          验证码:<input type="text" name="checkcode" value="" size="4" />
          <img src="CheckCode" alt="验证码" onclick="self.location.reload();" style="cursor: pointer" 
               alt="如果看不清验证码，请点图片刷新" align="middle"/><br/><p/>
          <input type="file" name="icon" value="" width="8" /><br/>
          <input id="randnum" type="hidden" name="idcode" value="" />
          <input type="reset" name="reset" value="重置">&nbsp;&nbsp;
        <input type="submit" value="提交" />
      </form>
    </body>
</html>
